package com.jiangroom.feign.web;

import com.jiangroom.feign.domain.User;
import com.jiangroom.feign.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {
    @Autowired
    private HelloService helloService;

    @RequestMapping("/feign-consumer")
    public String hello() {
        return helloService.hello();
    }

    @RequestMapping("/feign-consumer2")
    public String hello2() {
        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello("didi")).append("\n");
        sb.append(helloService.hello("haha", 1L)).append("\n");
        sb.append(helloService.hello(new User(2L, "xixi"))).append("\n");
        return sb.toString();
    }
}
